const SearchResult = new Lang.Class({
Name: 'SearchResult',
- _init: function(provider, metaInfo) {
+ _init: function(provider, metaInfo, resultsView) {
this.provider = provider;
this.metaInfo = metaInfo;
+ this._resultsView = resultsView;
this.actor = new St.Button({ reactive: true,
can_focus: true,
ICON_SIZE: 24,
- _init: function(provider, metaInfo) {
- this.parent(provider, metaInfo);
+ _init: function(provider, metaInfo, resultsView) {
+ this.parent(provider, metaInfo, resultsView);
this.actor.style_class = 'list-search-result';
this.actor.x_fill = true;
Name: 'GridSearchResult',
Extends: SearchResult,
- _init: function(provider, metaInfo) {
- this.parent(provider, metaInfo);
+ _init: function(provider, metaInfo, resultsView) {
+ this.parent(provider, metaInfo, resultsView);
this.actor.style_class = 'grid-search-result';
const SearchResultsBase = new Lang.Class({
Name: 'SearchResultsBase',
- _init: function(provider) {
+ _init: function(provider, resultsView) {
this.provider = provider;
+ this._resultsView = resultsView;
this._terms = [];
_createResultDisplay: function(meta) {
if (this.provider.createResultObject)
- return this.provider.createResultObject(meta);
+ return this.provider.createResultObject(meta, this._resultsView);
return null;
},
Name: 'ListSearchResults',
Extends: SearchResultsBase,
- _init: function(provider) {
- this.parent(provider);
+ _init: function(provider, resultsView) {
+ this.parent(provider, resultsView);
this._container = new St.BoxLayout({ style_class: 'search-section-content' });
this.providerInfo = new ProviderInfo(provider);
},
_createResultDisplay: function(meta) {
- return this.parent(meta) || new ListSearchResult(this.provider, meta);
+ return this.parent(meta, this._resultsView) ||
+ new ListSearchResult(this.provider, meta, this._resultsView);
},
_addItem: function(display) {
Name: 'GridSearchResults',
Extends: SearchResultsBase,
- _init: function(provider, parentContainer) {
- this.parent(provider);
+ _init: function(provider, resultsView) {
+ this.parent(provider, resultsView);
// We need to use the parent container to know how much results we can show.
// None of the actors in this class can be used for that, since the main actor
// goes hidden when no results are displayed, and then it lost its allocation.
// Then on the next use of _getMaxDisplayedResults allocation is 0, en therefore
// it doesn't show any result although we have some.
- this._parentContainer = parentContainer;
+ this._parentContainer = resultsView.actor;
this._grid = new IconGrid.IconGrid({ rowLimit: MAX_GRID_SEARCH_RESULTS_ROWS,
xAlign: St.Align.START });
},
_createResultDisplay: function(meta) {
- return this.parent(meta) || new GridSearchResult(this.provider, meta);
+ return this.parent(meta, this._resultsView) ||
+ new GridSearchResult(this.provider, meta, this._resultsView);
},
_addItem: function(display) {
let providerDisplay;
if (provider.appInfo)
- providerDisplay = new ListSearchResults(provider);
+ providerDisplay = new ListSearchResults(provider, this);
else
- providerDisplay = new GridSearchResults(provider, this.actor);
+ providerDisplay = new GridSearchResults(provider, this);
providerDisplay.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
providerDisplay.actor.hide();